#!/bin/bash
# *************************************************************************
# Copyright: (c) Huawei Technologies Co., Ltd. 2022. All rights reserved
#
#  description: the script that build CBB in component
#  date: 2022-03-01
#  version: 3.0.0
#  history:
#
# *************************************************************************

# Clone CBB code to local dir
CBB_REPO=https://gitcode.com/opengauss/CBB.git
CBB_BRANCH=master

echo "clone dcc code"
if [ -d CBB ]; then
    rm -rf CBB
fi
git clone ${CBB_REPO} -b ${CBB_BRANCH} CBB
cd CBB

LOCAL_PATH="$(pwd)"
LOCAL_DIR=$(dirname "${LOCAL_PATH}")
ROOT_DIR="${PWD}/../../.."
export PLAT_FORM_STR=$(sh ${LOCAL_DIR}/../../build/get_PlatForm_str.sh)

cp -r ${GCC_PATH} ${ROOT_DIR}/output/buildtools/
sh -x build.sh -3rd "${ROOT_DIR}/output"
